package com.hyt.schedule;

import com.alibaba.fastjson.JSON;
import com.hyt.application.api.request.OutwardRemittanceQueryRequest;
import com.hyt.application.api.request.OutwardRemittanceRequest;
import com.hyt.application.api.response.CommonRemittanceResponse;
import com.hyt.application.service.OutwardRemittanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ScheduledTask01  implements ScheduledTaskJob{

    @Autowired
    OutwardRemittanceService service;


    private final static String jsonData = "{\n" +
            "\t\"channel\": \"05\",\n" +
            "\t\"gwReqDate\": \"2021-04-25\",\n" +
            "\t\"gwReqTime\": \"17:16:41\",\n" +
            "\t\"serviceFlowNo\": \"ZT2021042319001325\",\n" +
            "\t\"orderFlowNo\": \"20210425171641118556\",\n" +
            "\t\"serviceId\": \"outward_remittance_query\",\n" +
            "\t\"txDt\": \"2021-04-23\",\n" +
            "\t\"txType\": \"01\"\n" +
            "}";

    @Scheduled(cron = "0 0/15 * * * ?")
    public void test() {
        OutwardRemittanceQueryRequest queryRequest = JSON.parseObject(jsonData,OutwardRemittanceQueryRequest.class);
        CommonRemittanceResponse response =  service.outwardRemittanceQuery(queryRequest);
        log.info("我在定时执行"+response.toString());
    }
}
